<%
String status = "";
if(request.getSession().getAttribute("status") != null){
	status = (String)request.getSession().getAttribute("status");
}else if(!status.equals("ingelogd")){
	response.sendRedirect("index.jsp?message=Log+eerst+in+om+verder+te+gaan");
}
//session.removeAttribute("status");
%>
<%@page import="model.*" %>
<%@page import="domein.*" %>
<%String eventNaam =""; String plaats =""; String Titel =""; String contactpersoon =""; String Organisator ="";%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Incentro Event Inviting System</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico" />
</head>

<body>

	<div id="wrapper">
	
		<div id="header">
			<a href="../eOverzicht.jsp" id="logo"><img src="img/logo.png" /></a>
		</div>	
		<%
	  	String genodigdeID = request.getParameter("genodigdeID");
	  	String eventID = request.getParameter("eventID");
	  	String name = request.getParameter("name");
	  	%>
	  	<h3><% out.print(name); %></h3>
		<div id="search-form">		
			<a href="status.jsp?eventID=<% out.print(eventID); %>"><input type="submit" value="Terug" class="terugButton" /></a>
			
	  	</div>
	  		<form method="post" action="opmerkingAdd.jsp" name="input">
	  			<span>
						<textarea rows="4" cols="61" name="opmerking" placeholder="Opmerking toevoegen."></textarea>
							
					<br />
					<br />
					Status
					
						<select name="status">
							<option value="0">Status aanpassen</option>
							<option value="1">Geaccepteerd</option>
							<option value="2">Afgewezen</option>
							<option value="3">Afwachtend</option>
						</select> <br />
						<input type="hidden" name="genodigdeID" value="<% out.print(genodigdeID); %>"/>
						<input type="hidden" name="eventID" value="<% out.print(eventID); %>"/>
					<br /><input type="submit" value="Toevoegen" />
				</span>
	  		</form>
	  	
	  	<table class="table" summary="Evenementen overzicht">
			<thead>
				<tr>
					<th scope="col">Contactpersoon</th>
					<th scope="col">datum</th>
					<th scope="col">opmerking</th>
					<th scope="col">status</th>
				</tr>
			</thead>
			<tbody>
			<%
			OpmerkingIO oIo = new OpmerkingIO();
			int counter = 1;	
			for(Opmerking o : oIo.listOpmerkingen(genodigdeID, eventID)){
				if(counter == 1){ 
				%><tr class="odd"><%
						counter = 2;
						}else{ %> <tr><% counter = 1;}%>	
						
					<td><%out.print(o.getGebruikerID());%></td>
					<td><%out.print(o.getDatum()); %></td>
					<td><%out.print(o.getOpmerking()); %></td>
					<td>
			<% 	if	(o.getStatus().equals("1")){ 		out.print("<font color='green'>Geaccepteerd</font>")	;}
				else if	(o.getStatus().equals("2")){ 	out.print("<font color='red'>Afgewezen</font>")		;} 
				else if	(o.getStatus().equals("0")){ 	out.print("")				;} 
				else {									out.print("Afwachtend")		;}
			%>
					</td>

				</tr>
				<%} %>
			</tbody>
		</table>	  	
		
	</div>

</body>

</html>